$(function () {
    //同时查询商品并进行分页
    $.ajax({
        type: "Post",
        url: "192.168.10.182/item/dis/p/getCommodityByMoreReason",
        dataType: "json",
        data:{commodityName:commodityName,cityId:102,typeId:typeId,clildTypeId:clildTypeId,dateStatus:dateStatus,zhiDingDate:zhiDingDate,orderStatus:orderStatus,isSeat:isSeat,pageNo:pageNo},
        success: function(data){

            var pageNo=data.curPage;
            var pageCount=data.pageCount;
            var $page=$(".M-box2");
            $page.html("");
            if (pageNo > 1) {
                //显示首页,上一页
                var $firstPage = $("<input type='button' name='btn' value='首页' class='Page' id='" + 1 + "'/>");
                var $prePage = $("<input type='button' name='btn' value='上一页' class='Page' id='" + (pageNo - 1) + "'/>");
                $page.append($firstPage).append($prePage);
            }
            if (pageNo < pageCount) {
                //显示尾页,下一页
                var $nextPage = $("<input type='button' name='btn' value='下一页' class='Page' id='" + (pageNo + 1) + "'/>");
                var $lastPage = $("<input type='button' name='btn' value='尾页' class='Page' id='" + pageCount + "'/>");
                $page.append($nextPage).append($lastPage);
            }
            $page.append("[当前页码" + pageNo + "/" + pageCount + "总页数]");

            var shopPageList=$("#shopPageList");
            shopPageList.html("");
            $.each(data.rows,function (i,e) {
                $.each(e.skuList,function (i,e2) {
                    var $li="<li class=\"text3-1\">";
                    if(e2.isDis==0){
                        var $li2=  " <div class=\"zhekou\">"+
                            "<div class=\"cut\">"+e2.discount+"</div>"+
                            "<div class=\"zhe\">折</div>"+
                            "</div>"
                        $li=$li+$li2;
                    }


                    var $li3=   "<a href=\"javascript:;\"  title="+e.commodityName+">"+
                        "<img src=\"../img/4-lxl1.jpg\" class=\"text3-1-1\">"+
                        "</a>"+
                        "<div class=\"text3-1-2\">"+
                        "<a href=\"javascript:;\" class=\"title tiaozhuan\">["+e.cityName+"]"+e.commodityName+"</a>"+
                        "<div class=\"pin\">"+
                        "<span>评分</span>"+
                        "<span class=\"pin1\">"+(e.star)*2+"</span>"+
                        "</div>"+
                        "<p class=\"stm\">"+getLocalTime(e.startTime)+" 至 "+getLocalTime(e.endTime)+"</p>"+
                        "<p class=\"stm\"><a href=\"javascript:;\">"+e.placeName+"</a></p>"+
                        "</div>"+
                        "<div class=\"text3-1-3\">"+
                        "<div class=\"text3-1-3-top\">"+
                        "<span class=\"tp1\">￥</span>"+
                        "<span class=\"tp2\">"+e.disPrice+"</span>"+
                        "<span class=\"tp3\">起</span>"+
                        "</div>"+
                        "<a href=\"javascript:;\" class=\"text3-1-3-bottom\" id='"+e.commodityId+"'>立即购买</a>"+
                        "</div>"+
                        "</li>";
                    $li=$li+$li3;
                    shopPageList.append($li);
                });
            });
        },
        error: function(msg){
            alert( "网络连接异常-进行分页-！！！");
        }
    });

});